package com.JingYan.rocketMq;

import com.JingYan.message.RocketMqMessage;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * RocketMQ 消费者2
 *
 * @author Dong_Jia_Qi on 2022/5/3
 */
@Slf4j
@Component
@RocketMQMessageListener(
        topic = RocketMqMessage.TOPIC,
        consumerGroup = "demo01-A-consumer-group-" + RocketMqMessage.TOPIC
)
public class AConsumer implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt messageExt) {
        log.info("[onMessage][线程编号:{} 消息内容：{}]", Thread.currentThread().getId(), messageExt);

    }
}
